home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / dpmigcc5.zip / RSX / SOURCE / FPU-EMU / POLY_MUL.S < prev    next >
Text File  |  1994-05-27  |  2KB  |  73 lines

  1. /*---------------------------------------------------------------------------+
  2.  |  poly_mul64.S                                                             |
  3.  |                                                                           |
  4.  | Multiply two 64 bit integers.                                             |
  5.  |                                                                           |
  6.  | Copyright (C) 1992    W. Metzenthen, 22 Parker St, Ormond, Vic 3163,      |
  7.  |                       Australia.  E-mail   billm@vaxc.cc.monash.edu.au    |
  8.  |                                                                           |
  9.  | Call from C as:                                                           |
  10.  |   void mul64(long long *a, long long *b, long long *result)               |
  11.  |                                                                           |
  12.  +---------------------------------------------------------------------------*/
  13.  
  14.  
  15. #include "fpu_asm.h"
  16.  
  17. .text
  18.     .align 2,144
  19. .globl _mul64
  20. _mul64:
  21.     pushl %ebp
  22.     movl %esp,%ebp
  23.     subl $16,%esp
  24.     pushl %esi
  25.     pushl %ebx
  26.  
  27.     movl PARAM1,%esi
  28.     movl PARAM2,%ecx
  29.     movl PARAM3,%ebx
  30.  
  31.     xor %eax,%eax
  32.     movl %eax,-4(%ebp)
  33.     movl %eax,-8(%ebp)
  34.  
  35.     movl (%esi),%eax
  36.     mull (%ecx)
  37.     movl %eax,-16(%ebp)    /* Not used */
  38.     movl %edx,-12(%ebp)
  39.  
  40.     movl (%esi),%eax
  41.     mull 4(%ecx)
  42.     addl %eax,-12(%ebp)
  43.     adcl %edx,-8(%ebp)
  44.     adcl $0,-4(%ebp)
  45.  
  46.     movl 4(%esi),%eax
  47.     mull (%ecx)
  48.     addl %eax,-12(%ebp)
  49.     adcl %edx,-8(%ebp)
  50.     adcl $0,-4(%ebp)
  51.  
  52.     movl 4(%esi),%eax
  53.     mull 4(%ecx)
  54.     addl %eax,-8(%ebp)
  55.     adcl %edx,-4(%ebp)
  56.  
  57.     testb $128,-9(%ebp)
  58.     je L_no_round
  59.  
  60.     addl $1,-8(%ebp)
  61.     adcl $0,-4(%ebp)
  62.  
  63. L_no_round:
  64.     movl -8(%ebp),%esi
  65.     movl %esi,(%ebx)
  66.     movl -4(%ebp),%esi
  67.     movl %esi,4(%ebx)
  68.  
  69.     popl %ebx
  70.     popl %esi
  71.     leave
  72.     ret
  73.